package com.loveget.onenight;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;

import com.loveget.onenight.ui.login.LoginActivity;
import com.loveget.onenight.util.SPUtil;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        getWindow().setStatusBarColor(Color.TRANSPARENT);

        new Handler().postDelayed(() -> {
            if (SPUtil.getInstance().getBoolean(SPUtil.IS_LOGIN)) {
                SplashActivity.this.startActivity(new Intent(SplashActivity.this, MainActivity.class));
            } else {
                SplashActivity.this.startActivity(new Intent(SplashActivity.this, LoginActivity.class));
            }
        }, 1000);
    }
}
